package com.zret.oasys.entity;
//考勤表实体类

import java.util.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * 考勤实体类
 * 
 * @author 77404 String attencetype考勤状态，规定：到岗（正常状态），迟到，旷工,请假
 */
public class Attence {
	// 流水号
	private long serialnum;
	// 员工编号
	private int empid;
	// 考勤时间
	private Date attencetime;
	// 考勤状态
	private String attencetype;

	// 日期的格式化
	private static SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	// 无参构造
	public Attence() {

	}

	// 带参构造
	public Attence(long serialnum, int empid, String attencetime, String attencetype) {
		super();
		this.serialnum = serialnum;
		this.empid = empid;
		this.setAttencetime(attencetime);
		this.attencetype = attencetype;
	}

	// 带参构造2
	public Attence(int empid, String attencetime, String attencetype) {
		super();
		this.empid = empid;
		this.setAttencetime(attencetime);
		this.attencetype = attencetype;
	}

	/**
	 * 带员工编号，考勤时间，考勤状态
	 * 
	 * @param empid
	 * @param attencetime
	 * @param attencetype
	 */
	public Attence(int empid, Date attencetime, String attencetype) {
		super();
		this.empid = empid;
		this.setAttencetime(attencetime);
		this.attencetype = attencetype;
	}

	// get/set
	public long getSerialnum() {
		return serialnum;
	}

	public void setSerialnum(long serialnum) {
		this.serialnum = serialnum;
	}

	public int getEmpid() {
		return empid;
	}

	public void setEmpid(int empid) {
		this.empid = empid;
	}

	public String getAttencetime() {
		return simple.format(attencetime);
	}

	// 考勤时间格式转换字符串
	public void setAttencetime(Date attencetime) {
		this.attencetime = attencetime;
	}

	// 考勤时间格式转换字符串
	public void setAttencetime(String attencetime) {
		try {
			this.attencetime = simple.parse(attencetime);
		} catch (ParseException e) {
			// 异常处理
			e.printStackTrace();
		}
	}

	public String getAttencetype() {
		return attencetype;
	}

	public void setAttencetype(String attencetype) {
		this.attencetype = attencetype;
	}

	/*********** 添加部门和职位和员工数据，实现json转list修改过程开始 *********************/
	private Dept dept;

	/**
	 * @return the dept
	 */
	public Dept getDept() {
		return dept;
	}

	/**
	 * @param dept the dept to set
	 */
	public void setDept(Dept dept) {
		this.dept = dept;
	}

	private Position pos;

	
	public Position getPosition() {
		return pos;
	}

	public void setPosition(Position pos) {
		this.pos = pos;
	}
	
	
	
	private Emp emp;
	
	public Emp getEmp() {
		return emp;
	}

	public void setEmp(Emp emp) {
		this.emp = emp;
	}

	/******** 添加部门和职位和员工数据，实现json转list修改过程 结束 ***************/

	@Override
	public String toString() {
		return "Attence [serialnum=" + serialnum + ", empid=" + empid + ", attencetime=" + getAttencetime()
				+ ", attencetype=" + attencetype + ", simple=" + simple + "]";
	}
}
